﻿using System.Windows;

namespace UIKitTutorials.Styles.CommonControl.Helpers
{
    public class TextBoxHelper
    {
        #region Unit
        public static string GetUnit(DependencyObject obj)
        {
            return (string)obj.GetValue(UnitProperty);
        }

        public static void SetUnit(DependencyObject obj, string value)
        {
            obj.SetValue(UnitProperty, value);
        }

        public static readonly DependencyProperty UnitProperty =
            DependencyProperty.RegisterAttached("Unit", typeof(string), typeof(TextBoxHelper));
        #endregion

        #region Min
        public static double GetMin(DependencyObject obj)
        {
            return (double)obj.GetValue(MinProperty);
        }

        public static void SetMin(DependencyObject obj, double value)
        {
            obj.SetValue(MinProperty, value);
        }

        public static readonly DependencyProperty MinProperty =
            DependencyProperty.RegisterAttached("Min", typeof(double), typeof(TextBoxHelper),new PropertyMetadata(double.MinValue));
        #endregion

        #region Max
        public static double GetMax(DependencyObject obj)
        {
            return (double)obj.GetValue(MaxProperty);
        }

        public static void SetMax(DependencyObject obj, double value)
        {
            obj.SetValue(MaxProperty, value);
        }

        public static readonly DependencyProperty MaxProperty =
            DependencyProperty.RegisterAttached("Max", typeof(double), typeof(TextBoxHelper),new PropertyMetadata(double.MaxValue));
        #endregion

        #region Decimals
        public static int GetDecimals(DependencyObject obj)
        {
            return (int)obj.GetValue(DecimalsProperty);
        }

        public static void SetDecimals(DependencyObject obj, int value)
        {
            obj.SetValue(DecimalsProperty, value);
        }

        public static readonly DependencyProperty DecimalsProperty =
            DependencyProperty.RegisterAttached("Decimals", typeof(int), typeof(TextBoxHelper),new PropertyMetadata(default(int)));
        #endregion
    }
}
